import axios from '@/utils/axios'

export const miniGoodsList = params => axios({
    method: 'get',
    url: '/admin/Goods/miniGoodsList',
    params
  }).then(res => res.data)
export const miniGoodsCreate = data =>
  axios.post('/admin/Goods/miniGoodsCreate', data)
    .then(res => res)
export const miniGoodsUpdate = data =>
  axios.post('/admin/Goods/miniGoodsUpdate', data)
    .then(res => res)
export const miniGoodsDelete = data =>
  axios.post('/admin/Goods/miniGoodsDelete', data)
    .then(res => res)


export const miniGoodsInfo = params => axios({
  method: 'get',
  url: '/admin/goods/miniGoodsInfo',
  params
}).then(res => res.data)
// 商品列表
export const goodsList = params => axios({
    method: 'get',
    url: '/admin/goods/index',
    params
  }).then(res => res.data)
// 订单页商品列表
export const goodsList2 = params => axios({
    method: 'get',
    url: '/admin/goods/goodsList',
    params
  }).then(res => res.data)
// 品项/商品列表
export const getGoodList = data => axios({
    method: 'post',
    url: '/crm/goods/getList',
    data
  }).then(res => res.data)
// 商品详情
export const goodsGetail = params => axios({
  method: 'get',
  url: '/admin/goods/detail',
  params
}).then(res => res.data)

// 添加商品
export const createGoods = data =>
  axios.post('/admin/goods/create', data)
    .then(res => res)
    
// 获取服务小项
export const goodsControls = params => axios({
  method: 'get',
  url: '/admin/goods/getControls',
  params
}).then(res => res.data)

// 编辑商品
export const updateGoods = data =>
  axios.post('/admin/goods/update', data)
    .then(res => res)

// 商品导出
export const exportGoods = data =>
  axios.post('/admin/goods/export', data)
    .then(res => res)

// 删除商品
export const deleteGoods = data =>
  axios.post('/admin/goods/delete', data)
    .then(res => res)

// 商品分类列表
export const categoryList = params => axios({
  method: 'get',
  url: '/admin/category/index',
  params
}).then(res => res.data)

// 新增商品分类
export const createCategory = data =>
  axios.post('/admin/category/create', data)
    .then(res => res)

// 商品分类详情
export const categoryDetail = params => axios({
  method: 'get',
  url: '/admin/category/detail',
  params
}).then(res => res.data)

// 更新商品分类
export const updateCategory = data =>
  axios.post('/admin/category/update', data)
    .then(res => res)

// 商品详情
export const pointGoodsList = params => axios({
  method: 'get',
  url: '/mini/CustomerPoint/pointGoodsList',
  params
}).then(res => res)
// 上传积分商品图
export const uploadPointGoodsImage = data =>
  axios.post('/mini/CustomerPoint/uploadPointGoodsImage', data)
    .then(res => res)
// 新增商品分类
export const addPointGoods = data =>
  axios.post('/mini/CustomerPoint/addPointGoods', data)
    .then(res => res)
// 商品详情
export const getPointGoodsDetail = params => axios({
  method: 'get',
  url: '/mini/CustomerPoint/getPointGoodsDetail',
  params
}).then(res => res)
// 编辑
export const editPointGoods = data =>
  axios.post('/mini/CustomerPoint/editPointGoods', data)
    .then(res => res)
// 修改状态
export const pointGoodsStatusUpdate = data =>
  axios.post('/mini/CustomerPoint/pointGoodsStatusUpdate', data)
    .then(res => res)

// 品项分析排名列表
export const goodsRankingList = params => axios({
  method: 'get',
  url: '/admin/goods/goodsRankingList',
  params
}).then(res => res.data)

// 商品列表
export const getGoodsList = params => axios({
  method: 'get',
  url: '/crm/ProductItem/getGoodsList',
  params 
}).then(res => res)
// 店铺列表
export const getShopList = params => axios({
  method: 'get',
  url: '/crm/ProductItem/getShopList',
  params 
}).then(res => res)

// 添加品项
export const addProductItem = data =>
  axios.post('/crm/ProductItem/addProductItem', data)
    .then(res => res)
// 修改品项
export const editProductItem = data =>
  axios.post('/crm/ProductItem/editProductItem', data)
    .then(res => res)

// 品项列表
export const getProductItem = params => axios({
  method: 'get',
  url: '/crm/ProductItem/getProductItem',
  params 
}).then(res => res.data)
// 品项类型列表
export const goodsTypeList = params => axios({
  method: 'get',
  url: '/crm/ProductItemType/getProductType',
  params 
}).then(res => res)
//添加品项分类
export const addProductType = data =>
  axios.post('/crm/ProductItemType/addProductType', data)
   .then(res => res)
// 修改品项分类
export const editProductType = data =>
  axios.post('/crm/ProductItemType/editProductType', data)
   .then(res => res)
// 获取品项类型父级
export const getProductTypeParent = params => axios({
  method: 'get',
  url: '/crm/ProductItemType/getLevelList',
  params 
})